package com.shangzhihao.good.controller;


import com.shangzhihao.good.domain.Brand;
import com.shangzhihao.good.domain.Goods;
import com.shangzhihao.good.service.GoodService;
import com.shangzhihao.good.service.GoodServices;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;



/**
 * @Author：尚志豪
 * @Package：com.shangzhihao.good.controller
 * @Project：ruoyi
 * @name：GoodController
 * @Date：2024/9/14 15:06
 */
@RestController
@RequestMapping("/good")
public class GoodController {
    @Autowired
    private GoodService service;
    @Autowired
    private GoodServices services;

    /** 列表 **/
    @GetMapping("/list")
    public List<Brand> listGood()
    {
        return service.list();
    }

    /** 添加 **/
    @PostMapping("/add")
    public boolean addGood(@RequestBody Brand goods)
    {
        return service.save(goods);
    }

    /** 删除 **/
    @PostMapping("/del")
    public boolean delGood(@RequestParam Integer id)
    {
        return service.removeById(id);
    }
    /** 修改 **/
    @PostMapping("/update")
    public boolean updateGood(@RequestBody Brand brand)
    {
        return service.updateById(brand);
    }

}
